<?php /* Smarty version Smarty-3.0.7, created on 2017-05-31 15:02:11
         compiled from "C:\wamp\www\gongzhonghao.yuanfenba.net/modules/admin/tpl/picwx/detail-pic.tpl" */ ?>
<?php /*%%SmartyHeaderCode:30150592e6a733b3a13-11533300%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '003da833725e80715a681965224ad615cb388c2f' => 
    array (
      0 => 'C:\\wamp\\www\\gongzhonghao.yuanfenba.net/modules/admin/tpl/picwx/detail-pic.tpl',
      1 => 1496214130,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '30150592e6a733b3a13-11533300',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<?php $_template = new Smarty_Internal_Template('header.tpl', $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php unset($_template);?>

<form class="form-inline" rel="ajax" method="post" action="/admin/PicWx/articleModify" enctype="multipart/form-data">
    <table class="table">

        <tr>
            <th style="width: 200px;">文章标题：</th>
            <td>
                <input required type="text" name="title" value="<?php echo $_smarty_tpl->getVariable('data')->value['title'];?>
"/>
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">所属公众号：</th>
            <td>
                <select required id="gzh_id" name="gzh_id" onblur="menuOneData()">
                    <option <?php if ($_smarty_tpl->getVariable('data')->value['wid']==0){?>selected<?php }?> value="0">请选择对应的公众号</option>
                    <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = Service_Gzh::gzh(); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                        <option  <?php if ($_smarty_tpl->getVariable('data')->value['wid']==$_smarty_tpl->tpl_vars['v']->value['wid']){?>selected<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['v']->value['wid'];?>
"><?php echo $_smarty_tpl->tpl_vars['v']->value['wid'];?>
-<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['v']->value['name'];?>
<?php $_tmp1=ob_GET_clean();?><?php echo $_tmp1;?>
</option>
                    <?php }} ?>
                </select>
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">所属的一级菜单：</th>
            <td>
                <select required name="menu_1" id="menu_1" onblur="menuTwoData()">
                    <option selected value="0">请选择所属的一级菜单</option>
                    <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = Service_Gzh::gzhMenu($_smarty_tpl->getVariable('data')->value['wid'],1); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                        <option  <?php if ($_smarty_tpl->getVariable('data')->value['mid']==$_smarty_tpl->tpl_vars['v']->value['id']){?>selected<?php }?> <?php if ($_smarty_tpl->getVariable('data')->value['pid']==$_smarty_tpl->tpl_vars['v']->value['id']){?>selected<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
-<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['v']->value['mname'];?>
<?php $_tmp2=ob_GET_clean();?><?php echo $_tmp2;?>
</option>
                    <?php }} ?>
                </select>
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">所属的二级菜单：</th>
            <td>
                <select name="menu_2" id="menu_2">
                    <option selected value="0">请选择所属的二级菜单</option>
                    <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = Service_Gzh::gzhMenu($_smarty_tpl->getVariable('data')->value['wid'],0); if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
                        <option  <?php if ($_smarty_tpl->getVariable('data')->value['mid']==$_smarty_tpl->tpl_vars['v']->value['id']){?>selected<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['v']->value['id'];?>
-<?php ob_start();?><?php echo $_smarty_tpl->tpl_vars['v']->value['mname'];?>
<?php $_tmp3=ob_GET_clean();?><?php echo $_tmp3;?>
</option>
                    <?php }} ?>
                </select>
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">类型：</th>
            <td>
                <select style="width: 150px;" required name="type">
                    <option <?php if ($_smarty_tpl->getVariable('data')->value['type']==1){?>selected<?php }?> value="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;小图</option>
                    <option <?php if ($_smarty_tpl->getVariable('data')->value['type']==2){?>selected<?php }?> value="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;大图</option>
                </select>
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">缩略图：</th>
            <td>
                <?php if ($_smarty_tpl->getVariable('data')->value['img_thumb']!=''){?>
                    <?php if ($_smarty_tpl->getVariable('data')->value['type']!=1){?><img src="<?php echo Service_Attach::getInstance()->getThumbUrl($_smarty_tpl->getVariable('data')->value['img_thumb'],200,200);?>
"><?php }?>
                    <?php if ($_smarty_tpl->getVariable('data')->value['type']!=2){?><img src="<?php echo Service_Attach::getInstance()->getThumbUrl($_smarty_tpl->getVariable('data')->value['img_thumb'],450,225);?>
"><?php }?>
                <?php }?>
                <input style="display: none;" type="text" name="img_thumb" value="<?php echo $_smarty_tpl->getVariable('data')->value['img_thumb'];?>
"/>
                <input type="file" name="img_thumb" value=""/>
                大图设置900*500 小图200*200
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">列表图片：</th>
            <td>
                <?php if ($_smarty_tpl->getVariable('data')->value['bg_img']!=''){?><img src="<?php echo Service_Attach::getInstance()->getThumbUrl($_smarty_tpl->getVariable('data')->value['bg_img'],192,192);?>
"><?php }?>
                <input style="display: none" type="text" name="bg_img1" value="<?php echo $_smarty_tpl->getVariable('data')->value['bg_img'];?>
"/>
                <input type="file" name="bg_img" value=""/>请上传300*200照片
            </td>
        </tr>

        <tr>
            <th style="width: 200px;">图片数量：</th>
            <td>
                <input type="text" name="count_pic" value="<?php echo $_smarty_tpl->getVariable('data')->value['count_pic'];?>
"/>
            </td>
        </tr>

        <tr>
            <th style="width:100px;">图片内容编辑：</th>
            <td>
                <textarea id="detail" class="form-control" style="width:700px; height:500px;"
                          name="detail"><?php echo $_smarty_tpl->getVariable('content')->value;?>
</textarea>
                <input style="display: none" name="id" value="<?php echo $_smarty_tpl->getVariable('data')->value['id'];?>
">
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <button type="submit" class="btn btn-primary">保存</button>
            </td>
        </tr>
    </table>
</form>

<script type="text/javascript">
    $(function() {
        create_editor('detail');
    });


    function menuOneData(){
        var wid= $('#gzh_id').val();
        $.ajax({
            type: 'post',
            url: '/admin/PicWx/menuOne',
            dataType: "json",
            async: false,
            data: {
                wid: wid
            },
            success: function (data) {
                $("#menu_1").empty();
                if(data.status == 200){
                    var count = data.data.length;
                    var b="<option selected='selected' value='' >请选择所属的一级菜单</option>";
                    for(i=0;i<count;i++){
                        b+="<option value='" + data.data[i]["id"] + "'>" + data.data[i]["mname"] + "</option>";
                    }
                    $("#menu_1").append(b);
                }else {
                    var b="<option selected='selected' value='' >请选择所属的一级菜单</option>";
                    $("#menu_1").append(b);
                }

            },
            error: function () {
                alert('编辑错误！');
            }
        })

    }

    function menuTwoData(){
        var pid= $('#menu_1').val();
        var wid= $('#gzh_id').val();
        $.ajax({
            type: 'post',
            url: '/admin/PicWx/menuTwo',
            dataType: "json",
            async: false,
            data: {
                pid: pid,
                wid: wid
            },
            success: function (data) {
                $("#menu_2").empty();
                if(data.status == 200){
                    var count = data.data.length;
                    var b="<option selected='selected' value='' >请选择所属的二级菜单</option>";
                    for(i=0;i<count;i++){
                        b+="<option value='" + data.data[i]["id"] + "'>" + data.data[i]["mname"] + "</option>";
                    }
                    $("#menu_2").append(b);
                }else {
                    var b="<option selected='selected' value='' >请选择所属的二级菜单</option>";
                    $("#menu_2").append(b);
                }

            },
            error: function () {
                alert('编辑错误！');
            }
        })

    }

</script>

<?php $_template = new Smarty_Internal_Template('footer.tpl', $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php unset($_template);?>